package com.rainner.admin.server;

import java.sql.SQLException;
import java.util.List;

import com.rainner.admin.javabean.BrrowedBookBean;
import com.rainner.admin.util.dbutil.BaseService;

public class BrrowedBookServer extends BaseService<BrrowedBookBean> {
	/**
	 * 根据书籍ID号查询哪些读者借阅
	 * @param bookId
	 * @return
	 * @throws SQLException
	 */
	public List<BrrowedBookBean> allDataByBookID(String bookId) throws SQLException{
		String sqlSelect = "select * from BrrowedBook where BookID = ?";
		return super.query(sqlSelect,bookId);
	}
	
	/**
	 * 根据读者用户名查询借阅哪些书籍
	 * @param readerUsername
	 * @return
	 * @throws SQLException
	 */
	public List<BrrowedBookBean> allDataByReaderUsername(String readerUsername) throws SQLException{
		String sqlSelect = "select * from BrrowedBook where ReaderUsername = ?";
		return super.query(sqlSelect,readerUsername);
	}
	/**
	 * 返回所有的接触书籍信息
	 * @return
	 * @throws SQLException
	 */
	public List<BrrowedBookBean> allData() throws SQLException{
		String sqlSelect = "select * from BrrowedBook ";
		return super.query(sqlSelect);
	}
	
}
